﻿$(document).ready(function () {

    var app = $.sammy('#Main', function (context) {
        this.get('#/account_pwdreset/', function () {
            LoadResetPassword();
        });
        this.get('#/account_confirm/', function () {
            var token = this.params['tk'];
            LoadConfirmActivation(token);
        });
        this.get('#/account_pwdresetaction/', function () {
            var token = this.params['tk'];
            LoadResetPasswordAction(token);
        });
    });


    $(function () { app.run('#'); });

});

function LoadConfirmActivation(token) {


    $.ajax({
        url: './Account/Confirm/',
        cache: false,
        data: { tk: token },
        success: function (html) {
            //alert(html);
            $('#Main').html(html);
            return false;
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert("Status: " + xhr.status + " Response Text: " + xhr.responseText);

        }
    });
    return false;
}

function LoadResetPassword() {
    $.ajax({
        url: './Account/PasswordResetRequest/',
        cache: false,
        success: function (html) {
            $('#Main').html(html);
            //$('#Nav').hide();
            return false;
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert("Status: " + xhr.status + " Response Text: " + xhr.responseText);

        }
    });
    return false;
}
function LoadResetPasswordAction(token) {
    $.ajax({
        url: './Account/PasswordReset/',
        cache: false,
        data: { tk: token },
        success: function (html) {
            $('#Main').html(html);
            return false;
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert("Status: " + xhr.status + " Response Text: " + xhr.responseText);
            $('#error-dis').text(thrownError);
            $('#register-error').css({ 'display': 'block' });

           

        }
    });
    return false;
}